<template>
    <div class="demandItemContainer">
            <el-table :border="Global.tableShowBorder" :data="recruitDemandItemList" style="background-color: #f6f6f6;">
                <el-table-column label="需求部门" align="center" prop="deptName"/>
                <el-table-column label="岗位" align="center" prop="postName"/>
                <el-table-column label="需要数量" align="center" prop="needCount"/>
                <el-table-column label="薪资范围" align="center" prop="salaryMin">
                    <template slot-scope="scope">
                        {{scope.row.salaryMin}} - {{scope.row.salaryMax}}
                    </template>
                </el-table-column>
                <el-table-column label="岗位需求" align="center" prop="postDemand">
                    <template slot-scope="scope">
                        <el-tooltip placement="top">
                            <div slot="content">
                                <div v-html="scope.row.postDemand"></div>
                            </div>
                            <el-button size="mini" type="text">岗位需求</el-button>
                        </el-tooltip>
                    </template>
                </el-table-column>
            </el-table>
<!--            <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"/>-->
    </div>
</template>

<script>
import {listRecruitDemandItem} from "@/api/hrm/recruitDemandItem";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";

export default {
    name: "RecruitDemandItem",
    props:{
        demandId: {
            type: [Number,String],
            default: null,
        }
    },
    data() {
        return {
            // 总条数
            total: 0,
            // 招聘需求明细表格数据
            recruitDemandItemList: [],
            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 20,
                demandId: null,
                deptId: null,
                postId: null,
                deptName:null,
                postName:null,
                needCount: null,
                postDemand: null
            }
        };
    },
    created() {
        if(this.demandId){
            //设置查询条件
            this.queryParams.demandId = this.demandId;
        }
        this.getList();
    },
    methods: {
        /** 查询招聘需求明细列表 */
        getList() {
            this.loading = true;
            listRecruitDemandItem(this.queryParams).then(response => {
                this.recruitDemandItemList = response.rows;
                this.total = response.total;
            });
        }
    }
};
</script>
<style scoped lang="scss">
.demandItemContainer{
    padding: 0px 20px;
    .el-table tr{
        background-color: #f6f6f6;
    }
}
</style>

<style scoped>
    /deep/.el-table tr,th{
        background-color: #fafafa;
    }
    /deep/.el-table th.el-table__cell.is-leaf{
        background-color: #fafafa;
    }

</style>
